package com.hyts.mvc.base.handler;

import com.hyts.mvc.model.HandlerWrapper;

import java.lang.reflect.InvocationTargetException;

/**
 * project-name:coffice-toolbox
 * package-name:com.hyts.mvc.base.handler
 * author:Libo/Alex
 * create-date:2019-07-08 14:50
 * email:liboware@gmail.com
 * description:此类主要用于:
 */
public class DefaultWebMvcHandler extends WebMvcHandler {

    /**
     * 成功true
     * 失败false
     * @param handlerWrapper
     * @return
     */
    @Override
    public boolean handle(HandlerWrapper handlerWrapper) {
        try {
            handlerWrapper.getExecuteMethod().invoke(handlerWrapper.getClazz().newInstance(),null);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        }
        return false;
    }
}
